/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.storage.entity;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank;
import org.hibernate.validator.constraints.Length;
import java.util.Date;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
import com.jeesite.common.collect.ListUtils;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 营销活动Entity
 */
@Table(name="biz_activity", alias="a", columns={
		@Column(name="id", attrName="id", label="唯一标识", isPK=true),
		@Column(name="sort", attrName="sort", label="顺序", isQuery=false),
		@Column(name="type", attrName="type", label="类型【限时秒杀/今日上新/全球精选】"),
		@Column(name="name", attrName="name", label="名称"),
		@Column(name="brand_id", attrName="brandId", label="品牌id"),
		@Column(name="thumbnail", attrName="thumbnail", label="活动缩略图"),
		@Column(name="introduction", attrName="introduction", label="活动说明", isQuery=false),
		@Column(name="start_time", attrName="startTime", label="开始时间", isQuery=false),
		@Column(name="end_time", attrName="endTime", label="结束时间", isQuery=false),
		@Column(name="picture", attrName="picture", label="图片【多个直接用＂|＂分割】", isQuery=false),
		@Column(name="shipping", attrName="shipping", label="发货说明", isQuery=false),
		@Column(name="free_shipping", attrName="freeShipping", label="包邮说明", isQuery=false),
		@Column(name="obscure", attrName="shipping", label="朦胧文字", isQuery=false),
		@Column(name="goods_num", attrName="goodsNum", label="商品数量"),
		@Column(name="new_goods_num", attrName="newGoodsNum", label="新品数量"),
		@Column(name="create_by", attrName="createBy", label="创建者", isQuery=false),
		@Column(name="create_date", attrName="createDate", label="创建时间", isQuery=false),
		@Column(name="update_by", attrName="updateBy", label="更新者", isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="更新时间", isQuery=false)
	},
		joinTable = {
				@JoinTable(type = JoinTable.Type.LEFT_JOIN,entity = Brand.class,alias = "b", on = "b.id = a.brand_id",
						columns = {
								@Column(includeEntity =  Brand.class)
						})
		},orderBy="a.update_date DESC"
)
public class Activity extends DataEntity<Activity> {

	private static final long serialVersionUID = 1L;
	private Integer sort;		// 顺序
	private String type;		// 类型【限时秒杀/今日上新/全球精选】
	private String name;		// 名称
	private String brandId;		// 品牌id
	private String thumbnail;    //缩略图
	private String introduction;		// 活动说明
	private Date startTime;		// 开始时间
	private Date endTime;		// 结束时间
	private String picture;		// 图片【多个直接用＂|＂分割】
	private String shipping;		// 发货说明
	private String freeShipping;		// 包邮说明

	public String getObscure() {
		return obscure;
	}

	public void setObscure(String obscure) {
		this.obscure = obscure;
	}

	private String obscure;		// 朦胧文字
	private Integer goodsNum;		// 商品数量
	private Integer newGoodsNum;		// 新品数量

	private Brand brand; //品牌
	private List<ActivityGoodsSpec> goodsSpecList = ListUtils.newArrayList();		// 子表列表

	public Activity() {
		this(null);
	}

	public Activity(String id){
		super(id);
	}

	public String getThumbnail() {
		return thumbnail;
	}

	public void setThumbnail(String thumbnail) {
		this.thumbnail = thumbnail;
	}

	@NotNull(message="顺序不能为空")
	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	@Length(min=0, max=8, message="类型长度不能超过 8 个字符")
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@NotBlank(message="名称不能为空")
	@Length(min=0, max=255, message="名称长度不能超过 255 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Length(min=0, max=64, message="品牌id长度不能超过 64 个字符")
	public String getBrandId() {
		return brandId;
	}

	public void setBrandId(String brandId) {
		this.brandId = brandId;
	}

	@Length(min=0, max=255, message="活动说明长度不能超过 255 个字符")
	public String getIntroduction() {
		return introduction;
	}

	public void setIntroduction(String introduction) {
		this.introduction = introduction;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@NotNull(message="开始时间不能为空")
	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@NotNull(message="结束时间不能为空")
	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	@Length(min=0, max=4096, message="图片【多个直接用＂|＂分割】长度不能超过 4096 个字符")
	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture;
	}

	@Length(min=0, max=255, message="发货说明长度不能超过 255 个字符")
	public String getShipping() {
		return shipping;
	}

	public void setShipping(String shipping) {
		this.shipping = shipping;
	}

	@Length(min=0, max=255, message="包邮说明长度不能超过 255 个字符")
	public String getFreeShipping() {
		return freeShipping;
	}

	public void setFreeShipping(String freeShipping) {
		this.freeShipping = freeShipping;
	}

	public Integer getGoodsNum() {
		return goodsNum;
	}

	public void setGoodsNum(Integer goodsNum) {
		this.goodsNum = goodsNum;
	}

	public Integer getNewGoodsNum() {
		return newGoodsNum;
	}

	public void setNewGoodsNum(Integer newGoodsNum) {
		this.newGoodsNum = newGoodsNum;
	}

	public Brand getBrand() {
		return brand;
	}

	public void setBrand(Brand brand) {
		this.brand = brand;
	}

	public List<ActivityGoodsSpec> getGoodsSpecList() {
		return goodsSpecList;
	}

	public void setGoodsSpecList(List<ActivityGoodsSpec> goodsSpecList) {
		this.goodsSpecList = goodsSpecList;
	}
}
